package com.gitee.mars.tourserver.controller;

import com.gitee.mars.tourserver.request.ScenicAreaRequest;
import com.gitee.mars.tourserver.response.result.R;
import com.gitee.mars.tourserver.service.IScenicAreaService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * ScenicArea 控制层
 *
 * @Author wq
 * @Date 2021-04-11
 * https://piao.qunar.com/ticket/list.htm?keyword=%E6%88%90%E9%83%BD+%E5%BF%85%E6%B8%B8%E6%99%AF%E7%82%B9&from=mpshouye_mustvisit_more
 **/
@RestController
@RequestMapping("/scenicArea")
@AllArgsConstructor
public class ScenicAreaController {

    private final IScenicAreaService scenicAreaService;

    /**
     * 获取数据
     *
     * @param city city
     */
    @GetMapping("/acquire")
    public R get(String city) {
        scenicAreaService.acquire(city);
        return R.success();
    }

    /**
     * 获取所有信息
     */
    @GetMapping("/acquireGlobal")
    public void acquireGlobal() {
        scenicAreaService.acquireGlobalCity();
    }

    /**
     * 列表
     *
     * @param request request
     * @return R
     */
    @PostMapping("/list")
    public R list(@RequestBody ScenicAreaRequest request) {
        return R.success(scenicAreaService.list(request));
    }

}